#include "stdafx.h"
#include "core/window.h"
#include "core/coresettings.h"

#include <QtGui/QApplication>

#include <string.h>

static
bool userWantsFullscreen(int argc, char* argv[])
{
    if (argc > 1)
    {
        const char* option = argv[1];
        if (!strcmp(option, "-fullscreen"))
        {
            return true;
        }
        if (!strcmp(option, "-window"))
        {
            return false;
        }
    }
    return false;
}

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    // Do you want use fullscreen?
    if (userWantsFullscreen(argc, argv))
        Core::CoreSettings::instance()->readSystemSettings();
    else
        Core::CoreSettings::instance()->setSettings(800, 600, false);

    {
        Core::Window w;
        if (Core::CoreSettings::instance()->isFullscreen())
            w.showFullScreen();
        w.show();
        return app.exec();
    }
}
